package controllers

import (
	"github.com/astaxie/beego"
	"fmt"
	"wcy-xmt-api/models"
)

const (
	REQ_ID = "fid"
	REQ_FILE = "file"
)

// 文件
type FileUploadController struct {
	beego.Controller
}

// @Title File
// @Description 文件上传
// @Param   type path int true "文件类型"
// @Param   file path byte[] true "内容"
// @Success 200 {object} models.ResStatus
// @Success 200 {object} models.File
// @router /byte [post]
func (this *FileUploadController) Byte() {
	fmt.Println("run login method")

	var resStatus = &models.ResStatus{}
	var file = &models.File{0,1212, "http://img1.mtime.cn/pi/d/2008/48/20081128144451.18644426.jpg"}

	resStatus.Code = 200
	resStatus.Data = file
	resStatus.ErrMsg = "OK"

	this.Data["json"] = resStatus
	this.ServeJson()
}

// @Title File
// @Description 文件上传
// @Param   type path int true "文件类型"
// @Param   file form file true "内容"
// @Success 200 {object} models.ResStatus
// @Success 200 {object} models.File
// @router / [post]
func (this *FileUploadController) File() {
	fmt.Println("run login method")

	var resStatus = &models.ResStatus{}
	var file = &models.File{0,1212, "http://img1.mtime.cn/pi/d/2008/48/20081128144451.18644426.jpg"}

	resStatus.Code = 200
	resStatus.Data = file
	resStatus.ErrMsg = "OK"

	this.Data["json"] = resStatus
	this.ServeJson()
}